package com.atguigu.mvc.entity;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Email;

public class Employee {

    // 限定字符串长度
    @Length(min = 3, max = 6)
    private String empName;

    // 限定数值类型的范围
    @Range(min = 18, max = 65)
    private Integer empAge;

    // 要求这个字段必须是符合规范的 Email 地址
    @Email
    private String empEmail;

    public String getEmpName() {
        return empName;
    }

    public void setEmpName(String empName) {
        this.empName = empName;
    }

    public Integer getEmpAge() {
        return empAge;
    }

    public void setEmpAge(Integer empAge) {
        this.empAge = empAge;
    }

    public String getEmpEmail() {
        return empEmail;
    }

    public void setEmpEmail(String empEmail) {
        this.empEmail = empEmail;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "empName='" + empName + '\'' +
                ", empAge=" + empAge +
                ", empEmail='" + empEmail + '\'' +
                '}';
    }

    public Employee(String empName, Integer empAge, String empEmail) {
        this.empName = empName;
        this.empAge = empAge;
        this.empEmail = empEmail;
    }

    public Employee() {
    }
}
